package com.free.mini.gateway.service;

import com.free.mini.gateway.constants.GatewayConstant;
import com.free.mini.gateway.filter.GatewayContext;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;

/**
 * @author dongsufeng
 * @version 4.0
 * @date 2023/8/7 17:33
 */
public interface ParseRequestBody {

    Map<String, ParseRequestBody> map = new HashMap<>();
    /**
     * 根据contentType判断是否支持
     * @return
     */
    Boolean support(GatewayContext gatewayContext);
    /**
     * body解析
     * @return
     */
    Mono<Void> parseBody(ServerWebExchange exchange, GatewayFilterChain chain, GatewayContext gatewayContext);

    /**
     * 解密
     * @param reqStr
     * @param gatewayContext
     */
    void decryptAndSign(String reqStr, GatewayContext gatewayContext);
}
